<?php if(!empty($subvo)){
    $v = $subvo;
    $subvo = '';
}
if(!empty($subsubvo)){
    $v = $subsubvo; 
    $subsubvo = '';
}
?>
<?php if($sendRegion == 0){?>
<div class="viewBox myBox<?php echo $v['id'];?>" <?php if($_SESSION[C('USER_AUTH_KEY')]){?> sortID="<?php echo $v['sort'];?>" modulesID="<?php echo $v['id'];?>" title="<?php echo $v['title'];?>" deleteUrl="<?php echo U('Admin/Modules/delete',array('id'=>$v['id']));?>" settingUrl="<?php echo U('Admin/Modules/edit',array('id'=>$v['id']));?>" isEdit="0"<?php }?>>
  <?php if(!empty($v['dataname'])){
                $v['content'] = $v['dataname'];
                
        }else{
            $v['content'] = unserialize($v['content']);
        }
         ?> 
  <div class="panel panel-primary"> 
    <?php include(TMPL_PATH.'Home/TemplateDefault/Public-Moduletitle'.C('TMPL_TEMPLATE_SUFFIX')); ?>
    <div class="panel-body" style="position:relative;">
    
    
    
    
    
    
      <ul class="list-group categoryList<?php echo $v['id'];?>" style="position:absolute; min-width:80px; z-index:3000;left:0; overflow-y:scroll; background:#fff; top:-3000px;">
      
      
      
        <?php foreach($v['content'] as $key => $vo){?>
        <li class="list-group-item list<?php echo $key+1;?>"> <a href="__APP__/<?php echo $vo['name'];?>"><img src="<?php echo getThumbPath($vo['img_url']);?>" height="14">&nbsp;<?php echo $vo['title'];?></a></li>
        <?php }?>
      </ul>
      <a href="javascript:void(0);" data-toggle="modal" data-target="#myModal<?php echo $v['id'];?>" class="btnCategoryList<?php echo $v['id'];?>"><i class="fa fa-map-marker"></i></a>
      
      
      <i id="free<?php echo $v['id'];?>" style="position:absolute; bottom:0; left:20px; border-bottom:5px solid #fff;display:none;
    border-bottom: 5px solid #fff;
    border-left: 5px solid #ccc;
    border-right: 5px solid #ccc; border-left-color:rgba(0,0,0,0.00); border-right-color:rgba(0,0,0,0.00); z-index:2001"></i>
      
      
      
      
      <div style="padding:5px;"><form class="bs-example bs-example-form" action="<?php echo $v['formAction'];?>" data-example-id="input-group-with-button" style="border:2px solid #ccc; background:#fff; border:1px solid #ccc; top:0; border-radius:30px;">
      
      
      
      
     
      
      
      
      
        <div class="row">
          <div class="col-lg-12" style="padding:0;">
            <div class="input-group">
              <input type="text" class="form-control" style="border-color:transparent; border-radius:30px 0 0 30px; box-shadow:none;" name="keywords" value="{$keywords}" placeholder="输入关键词">
              <span class="input-group-btn">
              <button style="border-color:transparent; border-radius:0 30px 30px 0;" class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
              </span> </div>
          </div>
          
          
          
          
          
          
         
          
          
          
        </div> 
      </form>
      <div style="height:5px;">
      </div>
      
      <span style="padding-top:5px;" id="areabox<?php echo $v['id'];?>"><?php echo $areaRet;?></span>
           <span style="" id="supplier<?php echo $v['id'];?>"></span></div>
      <!-- --> 
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      <div class="row list<?php echo $v['id'];?>"> 
        <!-- 左边分类 -->
        <div class="col-xs-3 col">
          <div class="list-group categoryList<?php echo $v['id'];?> categoryListniceScroll<?php echo $v['id'];?>" style="margin-right:8px;overflow-y:scroll;">
            <?php foreach($subCategory as $key => $val){?>
            <a href="##" cid="<?php echo $val['id'];?>" class="list-group-item <?php if($val['id'] == $category_id){?>active<?php }?>"><?php echo $val['title'];?></a>
            <?php }?>
          </div>
        </div>
        <!-- 左边分类结束 -->
        <?php if($ajax){?>
        <!-- 右边列表 -->
        <div class="col-xs-9 col">
          <?php if(!$list){?>
          <div class="row categoryList<?php echo $v['id'];?> categoryListniceScroll<?php echo $v['id'];?>"  style="overflow-y:scroll;"> 
            
            <!-- 分类列表 --> 
            
            <?php foreach($subcate as $key => $val){?>
            <div class="col-xs-4 col">
              <div class="thumbnail"> <a href="##" cid="<?php echo $val['id'];?>"><img data-src="<?php echo $val['img_url'];?>" alt="" src="<?php echo getThumbPath($val['img_url']);?>" data-holder-rendered="true" style="width: 100%; display: block;"></a>
                <div class="caption">
                  <h3><a href="##" cid="<?php echo $val['id'];?>"><?php echo $val['title'];?></a></h3>
                </div>
              </div>
            </div>
            <?php }?>
            
            <!-- 分类列表结束 --> 
            
          </div>
          <?php }?>
          <div class="row goodsList<?php echo $v['id'];?> goodsListniceScroll<?php echo $v['id'];?>" style="overflow-y:scroll;"> 
            
            <!-- 商品列表 -->
            
            <?php foreach($list as $key => $val){?>
            <div class="col-xs-4 col">
              <div class="thumbnail"> <a href="<?php echo getArtLink($val['id'],1);?>"><img data-src="<?php echo $val['img_url'];?>" alt="" src="<?php echo getThumbPath($val['img_url']);?>" data-holder-rendered="true" style="width: 100%; display: block;"></a>
                <div class="caption">
                  <h3><a href="<?php echo getArtLink($val['id'],1);?>"><?php echo $val['title'];?></a></h3>
                </div>
              </div>
            </div>
            <?php }?>
            
            <!-- 商品列表结束 --> 
            
          </div>
        </div>
        <!-- 右边列表结束 -->
        <?php } ?>
      </div>
      
      
      
      
      
      
      
      
      
      
      
    </div>
  </div>
    <?php if(strtolower(GROUP_NAME) != 'admin'){?>
  <script>
	
	function getSupplier(){
		var area = new Array();
		$("#areabox<?php echo $v['id'];?> select").each(function(index, element) {
            if($(this).val()*1 > 0){
				area.push($(this).val());
			}
        });
		
		$.post('<?php echo U('Ajax/getSupplier');?>', {area:area}, function(data){
			$('#supplier<?php echo $v['id'];?>').html(data);
		},'html');
		
		
		
		
		
		
	}
	
	
	function removnextAll(e){
		if($(e).next().length>0){
			removnextAll($(e).next());
			$(e).next().remove();
		}
	}
	
	
	function getProduct(s){
		$.post('<?php echo U('Ajax/getCategoryListOrProductList');?>', {supplier_id:$('#supplier<?php echo $v['id'];?> select').val(),sendRegion:1,cid:<?php echo $cid;?>,area:getareastr(),category_id:$('.categoryList<?php echo $v['id'];?>').find('.active').eq(0).attr('cid'),id:<?php echo $v['id'];?>}, function(data){
					$('.myBox<?php echo $v['id'];?> .goodsList<?php echo $v['id'];?>').html(data);
				}, 'html');
	}
	
	function sendRegion(e){
		if(e.value>0){
			$.ajax({
			url:"<?php echo U('Ajax/getRegion');?>",
			data:"fid="+e.value,
			type:"POST",
			dataType:"html",
				success: function(data){
					removnextAll(e);
					$(e).parent().append(data);
					getSupplier();
				}
		    });
	    }else{
		    removnextAll(e);
	    }
		
		
		
		$.post('<?php echo U('Ajax/getCategoryListOrProductList');?>', {supplier_id:$('#supplier<?php echo $v['id'];?> select').val(),sendRegion:1,cid:<?php echo $cid;?>,area:getareastr(),category_id:$('.categoryList<?php echo $v['id'];?>').find('.active').eq(0).attr('cid'),id:<?php echo $v['id'];?>}, function(data){
					$('.myBox<?php echo $v['id'];?> .goodsList<?php echo $v['id'];?>').html(data);
				}, 'html');
		
		
	    return false;
	}


  
  
  
      $(document).ready(function(e) {
		  
		  
	    <?php if($areaRet == ''){?>
		
		$.ajax({
			url:"<?php echo U('Ajax/getRegion');?>",
			data:"",
			type:"POST",
			dataType:"html",
			success: function(data){
				$('#areabox<?php echo $v['id'];?>').html(data);
				getSupplier();
			}
		});
		 <?php }?>
		  
		  var windowheight = $(window).height();
		  $('.viewBox').each(function(index, element) {
			  if($(this).attr('id') != 'myBox<?php echo $v['id'];?>'){
                  windowheight -= $(this).height();
			  }
          });
		  
		  $('#myBox<?php echo $v['id'];?> .categoryList<?php echo $v['id'];?>').height(windowheight - 10 - $('#myBox<?php echo $v['id'];?> .nav-glyphicons-list').height());
		  $('#myBox<?php echo $v['id'];?> .goodsList<?php echo $v['id'];?>').height(windowheight - 10 - $('#myBox<?php echo $v['id'];?> .nav-glyphicons-list').height());
		  
		  if($('.categoryList<?php echo $v['id'];?> .col').length > 0){
		      $('.goodsList<?php echo $v['id'];?>').remove();
		  }
		     
		  
        $('.categoryList<?php echo $v['id'];?> a').each(function(index, element) {
            $(this).click(function(e) {
                $.post('<?php echo U('Ajax/getCategoryListOrProductList');?>', {supplier_id:$('#supplier<?php echo $v['id'];?> select').val(),sendRegion:1,cid:<?php echo $cid;?>,area:getareastr(),category_id:$(this).attr('cid'),id:<?php echo $v['id'];?>}, function(data){
					$('.myBox<?php echo $v['id'];?> .goodsList<?php echo $v['id'];?>').html(data);
					
					$('.categoryList<?php echo $v['id'];?> a').removeClass('active');
					$('.categoryList<?php echo $v['id'];?> a').eq(index).addClass('active');
					
				}, 'html');
            });
        }); 
		
		
		 
		 
		<?php if(!$ajax){?>
		
		    
		        $.post('<?php echo U('Ajax/getCategoryListOrProductList');?>', {supplier_id:$('#supplier<?php echo $v['id'];?> select').val(),cid:<?php echo $cid;?>,area:getareastr(),id:<?php echo $v['id'];?>}, function(data){
					$('.myBox<?php echo $v['id'];?>').parent('.column').html(data);
				}, 'html');
		    
		        //$('.categoryList<?php echo $v['id'];?> a').eq(0).click();
			
			 
		<?php }?>
		
		
		
		
		
		
    });
	
	
	
	function getareastr(){
		var strarray = new Array();
		$('#areabox<?php echo $v['id'];?> select').each(function(index, element) {
            if($(this).val()*1 > 0){
				strarray.push($(this).val());
			}
        });
		return strarray;
	}
	
	
	

	
  </script>
  <?php }?>
  
  
  
  
</div>
<?php }else{?>

<!-- 商品列表 -->
            
            <?php foreach($list as $key => $val){?>
            <div class="col-xs-4 col">
              <div class="thumbnail"> <a href="<?php echo getArtLink($val['id'],1);?>"><img data-src="<?php echo $val['img_url'];?>" alt="" src="<?php echo getThumbPath($val['img_url']);?>" data-holder-rendered="true" style="width: 100%; display: block;"></a>
                <div class="caption">
                  <h3><a href="<?php echo getArtLink($val['id'],1);?>"><?php echo $val['title'];?></a></h3>
                </div>
              </div>
            </div>
            <?php }?>
            
            <!-- 商品列表结束 --> 
<?php }?>